package com.jinzhi.jzcultivate.controller;
import com.jinzhi.common.annotation.Log;
import com.jinzhi.common.base.BaseController;
import com.jinzhi.jzapi.training.pojo.CoursesAndTeacherVo;
import com.jinzhi.jzweb.service.CoursesService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@AllArgsConstructor
@RequestMapping("/cultivate/study")
public class StudyController extends BaseController {

	private CoursesService coursesService;

	@Log("在线学习")
	@GetMapping("/studyOnline")
	String studyOnline(Model model){
		return "cultivateWeb/study/studyOnline";
	}

	@Log("学习详情")
	@GetMapping("/studyInfo")
	String studyInfo(Model model,String id,String isTestScores){
		CoursesAndTeacherVo coursesAndTeacherVo = coursesService.selCourseDetail(Long.parseLong(id));
		model.addAttribute("cou" , coursesAndTeacherVo);
		model.addAttribute("isTestScores",isTestScores);
		return "cultivateWeb/study/studyInfo";
	}

	@Log("答题解析列表")
	@GetMapping("/studyAnswer")
	String studyAnswer(Model model,String id){
		model.addAttribute("id",id);
		return "cultivateWeb/study/studyAnswer";
	}

	@Log("随机练习")
	@GetMapping("/studyPractice")
	String studyPractice(Model model,String id,String courseId,String isTestScores){
		model.addAttribute("id",id);
		model.addAttribute("courseId",courseId);
		model.addAttribute("isTestScores",isTestScores);
		return "cultivateWeb/study/studyPractice";
	}

	@Log("试卷测试")
	@GetMapping("/studyExam")
	String studyExam(Model model,String id,String type,String isTestScores){
		model.addAttribute("id",id);
		model.addAttribute("type",type);
		model.addAttribute("isTestScores",isTestScores);
		return "cultivateWeb/study/studyExam";
	}

	@Log("解析详情")
	@GetMapping("/studyAnswerDetail")
	String studyAnswerDetail(Model model,String answerId,String courseId){
		model.addAttribute("answerId",answerId);
		model.addAttribute("courseId",courseId);
		return "cultivateWeb/study/studyAnswerDetail";
	}

	@Log("章节详情—视频播放")
	@GetMapping("/studyChapter")
	String studyChapter(Model model,String id,String chapterId,String courseId){
			model.addAttribute("chapterId",chapterId);
			model.addAttribute("id",id);
			model.addAttribute("courseId",courseId);
			return "cultivateWeb/study/studyChapter";
	}

}
